UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IM6PMzJ6qmx2I9fP9/K8yGglLEGPcaFBsSzJieckZ9k=' 
WHERE 
  key_id = '1b67bbc804b02ae92b96334daa84d2521020feb163cf105e459e26757e62d4c6' 
  AND (
    token = 'IM6PMzJ6qmx2I9fP9/K8yGglLEGPcaFBsSzJieckZ9k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030