UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tc+cstQIII6IAROYpA52d482PTukC7d632PxXTDy9dM=' 
WHERE 
  key_id = '3bb1244b64b3e9cc27f06ec64a33b55f64648705346855b6e7d679b9e9cca1b0' 
  AND (
    token = 'tc+cstQIII6IAROYpA52d482PTukC7d632PxXTDy9dM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034