UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YKLP4W+cMDpZmgwXJZsZwjRxKzprxwsh2g9nAn+Hf84=' 
WHERE 
  key_id = 'b0ca46409ac766118dc9b32ecfc4f9622237f4a2c807690ced68d464139d43c8' 
  AND (
    token = 'YKLP4W+cMDpZmgwXJZsZwjRxKzprxwsh2g9nAn+Hf84=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046