UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2XtKRifVI1WoXuE/jTr3Op0K45AFWyypGOomvzfg3AY=' 
WHERE 
  key_id = '24cc7fe204f944ebe9fcde49edd6bf2e932bf14ab8ba223a1f35bb26496777b6' 
  AND (
    token = '2XtKRifVI1WoXuE/jTr3Op0K45AFWyypGOomvzfg3AY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038