UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5LiBCZ5Ai25/wE4/RhfyxAFfaTXEfe9o3e10Nw6gdTU=' 
WHERE 
  key_id = '5e8116b7c8469e0cb5bff97735bea4c975a53616a6dda9e5441575be07399b30' 
  AND (
    token = '5LiBCZ5Ai25/wE4/RhfyxAFfaTXEfe9o3e10Nw6gdTU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034