UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'brezRFLkK1+0VY1ta7Vf1ch2VYddasLO4I01VvoI5hQ=' 
WHERE 
  key_id = '8b15605d181e502ff6e3ca9b795259e74c4d2096beea729fd31a18341ecc9087' 
  AND (
    token = 'brezRFLkK1+0VY1ta7Vf1ch2VYddasLO4I01VvoI5hQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044