UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nrGg9QFO3SfKe4a1nHfYvnuXDuctVZjrpFbfJlrzwj4=' 
WHERE 
  key_id = '1d40818dfa4af2db05b4efa0bf99e21ac2fa11612a04436e9b4295c657af12fb' 
  AND (
    token = 'nrGg9QFO3SfKe4a1nHfYvnuXDuctVZjrpFbfJlrzwj4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00074