UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RUJRIWXr7ZVYzPlgasOBy0JxuveyqJPfrkTPPiGDxzQ=' 
WHERE 
  key_id = '688b2d46e98805b4c364e233084baad52613d087c388680049d7c0dbde8b353d' 
  AND (
    token = 'RUJRIWXr7ZVYzPlgasOBy0JxuveyqJPfrkTPPiGDxzQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031