UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'W+/X4uAUEkUqVPw4pv8lV3pzyX3o2/qgBa/6Cg82mKY=' 
WHERE 
  key_id = 'b61fb39effc47fc2421b9de12489c8dda2316ad94de1c3557289830b78090f19' 
  AND (
    token = 'W+/X4uAUEkUqVPw4pv8lV3pzyX3o2/qgBa/6Cg82mKY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042