UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'euMbRZ2wPg7J6pcTiI0GKMSLdALsQ6mf/UjUPHdJ70o=' 
WHERE 
  key_id = '8396a56489c9887b1d2ca0769fec397a42fe382cec4f56a47c2033f4f135b42c' 
  AND (
    token = 'euMbRZ2wPg7J6pcTiI0GKMSLdALsQ6mf/UjUPHdJ70o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020