UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6vmWY1TEfqFTqLx63zde4E2bMN87Aj4yGbolGI8q2FQ=' 
WHERE 
  key_id = '796593695a3745a53f72dae4fdbe66eafe2194276aa1735939187705d3e987c2' 
  AND (
    token = '6vmWY1TEfqFTqLx63zde4E2bMN87Aj4yGbolGI8q2FQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023