UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VQ1SsMlsimwS/xI2TCe2u/Y+gyQgfqanmb2Pxz+4qjk=' 
WHERE 
  key_id = 'f9111b1938ded046235c858652da9230a7b50e285bac74f9567fb948c75fcb9e' 
  AND (
    token = 'VQ1SsMlsimwS/xI2TCe2u/Y+gyQgfqanmb2Pxz+4qjk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029