UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y3R0LC2/DpiUkZzqfSoZrXdKR0LeL0nCFQaMPJ+l2S0=' 
WHERE 
  key_id = '5f4f591597ef2abd6f0503f7461689b74f217c46755002f12d2de0c105047fb3' 
  AND (
    token = 'Y3R0LC2/DpiUkZzqfSoZrXdKR0LeL0nCFQaMPJ+l2S0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054