UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qmOWCdw27eLp7eBPzgWT2EgiGUIkjJkGHeIMo4/T87M=' 
WHERE 
  key_id = 'e883e379490e83519cf633b609e87e273feb59d403b5b808888a671ebaf2abd2' 
  AND (
    token = 'qmOWCdw27eLp7eBPzgWT2EgiGUIkjJkGHeIMo4/T87M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026