UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'znNlHD2BgIqoHM0dVfHRRToofzEundwk/JgIgIAacOk=' 
WHERE 
  key_id = 'bc1d3855fb024f36797967388d0c6b17008d5f3584b9ab3a9587e5c68da29970' 
  AND (
    token = 'znNlHD2BgIqoHM0dVfHRRToofzEundwk/JgIgIAacOk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032