UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ktbQnJrNTgZL9tx76e+OO+4XyM+0OtXjhm6bzxZvy4w=' 
WHERE 
  key_id = '58679c3852d6ffb25a6466b86519b7db3dfc02faf056f7a65230cd8d46ab751f' 
  AND (
    token = 'ktbQnJrNTgZL9tx76e+OO+4XyM+0OtXjhm6bzxZvy4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035