UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PP0m7aAVcyEDe63muQV3B612lbZgsllLyCKo7B0+mbI=' 
WHERE 
  key_id = '892ba810f8dfdea364da03e188595352e5346ed397f701f9543d07a467ef9fad' 
  AND (
    token = 'PP0m7aAVcyEDe63muQV3B612lbZgsllLyCKo7B0+mbI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052