UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zKf9VcFurwUpw1aoz9YIefXXGx+t+f9zDsGEDczwVxY=' 
WHERE 
  key_id = '2ee254b200c5684bdc0aa3459de105b6a48f994747fc52b186075be37229e911' 
  AND (
    token = 'zKf9VcFurwUpw1aoz9YIefXXGx+t+f9zDsGEDczwVxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030