UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uwrbFWCnCYozYnTr6tRiyi2prubiAPyySNCmlT67j2M=' 
WHERE 
  key_id = '8ab39bfa9ea163ac3717b1a98e5e153572f8a6f9819ef2aef111a698d5464229' 
  AND (
    token = 'uwrbFWCnCYozYnTr6tRiyi2prubiAPyySNCmlT67j2M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054