UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iWg70qLP0ZV0ISWVt3jaqZq0epv+vp3dM++2WSsUVhk=' 
WHERE 
  key_id = 'a4aaf4c5d3011edb7fd065235bbe2700dd2c046a3f7fbe879a32b05528747416' 
  AND (
    token = 'iWg70qLP0ZV0ISWVt3jaqZq0epv+vp3dM++2WSsUVhk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022