UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M/JheSw1J3u0YyQnDh2JIHM538ST/hYaekT1fz5oQVU=' 
WHERE 
  key_id = 'fb50485ccc771371f18bb413d859d6b6cce4ac578fb11f07e71c33329fc1b943' 
  AND (
    token = 'M/JheSw1J3u0YyQnDh2JIHM538ST/hYaekT1fz5oQVU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033