UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hOefTcHbRzTzUatOvXRvlUaloSHlNCPkArq5ep69CR8=' 
WHERE 
  key_id = '1099393a5304ec937ccf55238af79ca3f1ebacad2e9384a3b43367fee2ca1b6d' 
  AND (
    token = 'hOefTcHbRzTzUatOvXRvlUaloSHlNCPkArq5ep69CR8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00059