UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3cOzSPrj2vC4LWoTV7iFvGphAzYQjQGaBVNKCfuZFGM=' 
WHERE 
  key_id = 'f12158850dd96a9f4a961effb2ad87e1737ce42d6fad68235c5e0e8e982c15a7' 
  AND (
    token = '3cOzSPrj2vC4LWoTV7iFvGphAzYQjQGaBVNKCfuZFGM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033