UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cs7FH7zPDm8V1jml2qhjsZ09eqMHY2ERwxU07Jg41jg=' 
WHERE 
  key_id = '57f51ab0e3d205ec494242a814449c5c23e3f9d42c659662f95fe25dfa4a94b6' 
  AND (
    token = 'Cs7FH7zPDm8V1jml2qhjsZ09eqMHY2ERwxU07Jg41jg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017