UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P6i+xS11mBVEugoy0HZGGEo8iohYVL+54wR2vVjtf38=' 
WHERE 
  key_id = 'd180b21fd0f6850116f803484d195a0cbbb353397ec2280a9ffff0bcaa95c22d' 
  AND (
    token = 'P6i+xS11mBVEugoy0HZGGEo8iohYVL+54wR2vVjtf38=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00056