UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RAAd68HR6xfgGjkctttWG2f14Yp0SOH1KXn90j2uZQs=' 
WHERE 
  key_id = '2089ce41662b06d6484b48a87136d8b6bbfbd7b5b542a819b6de62de27afea44' 
  AND (
    token = 'RAAd68HR6xfgGjkctttWG2f14Yp0SOH1KXn90j2uZQs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033