UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YUY0eiNLfo4sVqA2r9IcZ+7d+rUg/Pnr70FzGyC+fhc=' 
WHERE 
  key_id = '7663e84cd478ba2592541b955f612062de97285db91ae19b31427ef9c20ef323' 
  AND (
    token = 'YUY0eiNLfo4sVqA2r9IcZ+7d+rUg/Pnr70FzGyC+fhc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029