UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M/Wsql+0YilIMoZvAjoHlq8wPuq94SFrHNcS8zLE1G8=' 
WHERE 
  key_id = '7e392e7db31b58972346adff4755ed8a5d570ff9a961657c402c9337427ece93' 
  AND (
    token = 'M/Wsql+0YilIMoZvAjoHlq8wPuq94SFrHNcS8zLE1G8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039