UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Fw/ytOy7oUzGj7fWWJ+lDQgbErRewqEvjAl0An4/OT4=' 
WHERE 
  key_id = 'd1b276f325483b220d75b7edf770a599ff844bbce54bf8a35780c0c229c819ba' 
  AND (
    token = 'Fw/ytOy7oUzGj7fWWJ+lDQgbErRewqEvjAl0An4/OT4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024