UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HCI3Rf29G/fws7qRrKop9PoVaNBzVEbCnxTUQPQsIL8=' 
WHERE 
  key_id = 'bfa450afbd1ac8319c68c421005694a1f3b8ec2fa6824ecda629cc6179861692' 
  AND (
    token = 'HCI3Rf29G/fws7qRrKop9PoVaNBzVEbCnxTUQPQsIL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027