UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2wa1QMURTKIo+MHqrylLu7G1+EqahuCkt1ePGQIjVno=' 
WHERE 
  key_id = '6782b19369fdb0a75e1d407f79214fcd6dc4fe433b39708157d9d2596fa68051' 
  AND (
    token = '2wa1QMURTKIo+MHqrylLu7G1+EqahuCkt1ePGQIjVno=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023