UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dfhuoPPncm50XXqe2sZe7LjX/f0gtJdtI+bi0grzTks=' 
WHERE 
  key_id = '45af0f43307a00f0bef81b5772b465ae8ab59fd9449eb0cbbb3f093f88e98019' 
  AND (
    token = 'dfhuoPPncm50XXqe2sZe7LjX/f0gtJdtI+bi0grzTks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034