UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vqP3CKpJjUyLTjjC4C5nAHlx4rvpY/cAEepJaTiSEFs=' 
WHERE 
  key_id = '877e235ba1559105ab0b6b307551d1689a83c910e809a4294cd4deca4470aff2' 
  AND (
    token = 'vqP3CKpJjUyLTjjC4C5nAHlx4rvpY/cAEepJaTiSEFs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030