UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qbukQw2mwbrY6939hPszKD+PO19cRvcyNoFApQbAICI=' 
WHERE 
  key_id = '46aaa7068ebb3cd28c7e332855c80f73d56fa3387a781951a5e52bba73885b3b' 
  AND (
    token = 'qbukQw2mwbrY6939hPszKD+PO19cRvcyNoFApQbAICI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030